#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
#include <math.h>
#include <string.h>

#include <arm_neon.h>
#include <time.h>

//note: const float *  && float * const  && float const *
//const float*  == float const *   ----------------------> pointer to const
//float * const                    ----------------------> const to pointer


void vector_dot_c(float32_t const *A, float32_t const *B, float32_t *C, uint32_t count)
{
    if(count < 0){
        *C = 0.0;
        return ;
    }
    *C = 0.0;
    for(int idx=0; idx<count; idx++){
        *C += A[idx]*B[idx];
    }
}


void vector_dot_intrinsics(float32_t const *src1, float32_t const *src2, float32_t *dst, uint32_t count)
{
    float32x4_t Aregister;
    float32x4_t Bregister;
    float32x4_t Cregister;

    Cregister = vmovq_n_f32(0.0);

    for(int idx=0; idx<count/4; idx++)
    {
        Aregister = vld1q_f32(src1+idx*4);
        Bregister = vld1q_f32(src2+idx*4);
        Cregister = vfmaq_f32(Cregister, Aregister, Bregister);
    }

    float32_t result[4] = {0.0};
    vst1q_f32(result, Cregister);
    //printf("%f,%f,%f,%f\n", result[0], result[1], result[2], result[3]);
    *dst = result[0] + result[1] + result[2] + result[3];
}

//###############################################################################################
//# void vector_dot_assembly(float32_t const *src1, float32_t const *src2, float32_t *dst, uint32_t count)
//# r0: dst
//# r1: src1
//# r2: src2
//# r3: count
//###############################################################################################
void vector_dot_assembly(float32_t const* src1, float32_t const * src2, float32_t *dst, uint32_t count)
{
    asm volatile (
    //"fmul v3.4s, v5.4s, v5.4s \n"
    //"fsub v3.4s, v3.4s, v3.4s \n"
    //"mov v3.4s, v5.4s \n"
    "mov w0, #0.0 \n"
    "dup v3.4s, w0 \n"
    "1: \n"
    "ld1 {v0.4s}, [%[src1]], #16 \n"
    "ld1 {v1.4s}, [%[src2]], #16 \n"
    "fmul v2.4s, v0.4s, v1.4s \n"
    "fadd v3.4s, v3.4s, v2.4s \n"
    "subs %w[count], %w[count], #4 \n"
    "bgt 1b \n"
    "st1 {v3.4s}, [%[dst]] \n"
    : [dst] "+r" (dst), [src1] "+r" (src1), [src2] "+r" (src2), [count] "+r" (count)
    :
    : "cc", "memory", "v0", "v1", "v2", "v3", "v5"
    );
}


int main(int argc, char* argv[])
{
    const float32_t arrayA[1024] = {-74.0, -79.0, -84.0, -85.0, -80.0, -71.0, -65.0, -64.0, -65.0, -63.0, -65.0, -64.0, -62.0, -61.0, -63.0, -60.0, -59.0, -59.0, -62.0, -66.0, -68.0, -75.0, -78.0, -82.0, -82.0, -73.0, -67.0, -68.0, -75.0, -81.0, -86.0, -85.0, -82.0, -76.0, -73.0, -68.0, -68.0, -69.0, -68.0, -68.0, -70.0, -71.0, -70.0, -68.0, -62.0, -59.0, -59.0, -59.0, -59.0, -55.0, -53.0, -53.0, -53.0, -52.0, -48.0, -48.0, -51.0, -57.0, -60.0, -61.0, -64.0, -60.0, -47.0, -7.0, 37.0, 48.0, 33.0, 22.0, 8.0, -15.0, -46.0, -59.0, -66.0, -68.0, -69.0, -70.0, -68.0, -73.0, -73.0, -73.0, -73.0, -75.0, -76.0, -75.0, -76.0, -75.0, -77.0, -78.0, -79.0, -78.0, -77.0, -77.0, -76.0, -76.0, -76.0, -77.0, -77.0, -80.0, -79.0, -75.0, -70.0, -66.0, -61.0, -57.0, -53.0, -52.0, -52.0, -53.0, -56.0, -54.0, -50.0, -47.0, -48.0, -46.0, -44.0, -45.0, -44.0, -44.0, -44.0, -45.0, -46.0, -47.0, -48.0, -48.0, -48.0, -48.0, -50.0, -51.0, -50.0, -48.0, -45.0, -43.0, -40.0, -37.0, -36.0, -34.0, -32.0, -32.0, -33.0, -34.0, -36.0, -39.0, -45.0, -47.0, -49.0, -47.0, -41.0, -21.0, -4.0, -2.0, -1.0, 8.0, 14.0, 4.0, -11.0, -19.0, -25.0, -30.0, -36.0, -36.0, -34.0, -32.0, -28.0, -26.0, -25.0, -26.0, -25.0, -26.0, -28.0, -30.0, -34.0, -34.0, -37.0, -38.0, -34.0, -35.0, -38.0, -32.0, -14.0, -4.0, -3.0, -5.0, -3.0, -4.0, -7.0, -16.0, -25.0, -32.0, -37.0, -36.0, -31.0, -33.0, -42.0, -43.0, -38.0, -33.0, -34.0, -38.0, -39.0, -37.0, -39.0, -44.0, -44.0, -42.0, -39.0, -41.0, -39.0, -33.0, -22.0, -23.0, -30.0, -29.0, -17.0, -1.0, -2.0, -18.0, -23.0, -21.0, -20.0, -28.0, -36.0, -42.0, -43.0, -41.0, -37.0, -35.0, -32.0, -29.0, -29.0, -30.0, -30.0, -30.0, -29.0, -29.0, -25.0, -19.0, -11.0, -2.0, 4.0, 13.0, 22.0, 30.0, 30.0, 26.0, 23.0, 11.0, -1.0, -6.0, -17.0, -30.0, -30.0, -27.0, -28.0, -28.0, -27.0, -27.0, -28.0, -30.0, -29.0, -28.0, -25.0, -26.0, -29.0, -36.0, -41.0, -44.0, -36.0, -35.0, -43.0, -39.0, -23.0, -16.0, -21.0, -33.0, -38.0, -28.0, -23.0, -30.0, -41.0, -41.0, -36.0, -30.0, -27.0, -28.0, -31.0, -35.0, -35.0, -37.0, -41.0, -42.0, -36.0, -29.0, -27.0, -35.0, -37.0, -34.0, -33.0, -33.0, -34.0, -33.0, -32.0, -31.0, -31.0, -34.0, -36.0, -36.0, -34.0, -42.0, -46.0, -50.0, -52.0, -48.0, -42.0, -36.0, -38.0, -39.0, -37.0, -33.0, -32.0, -35.0, -40.0, -45.0, -46.0, -49.0, -52.0, -53.0, -56.0, -57.0, -61.0, -57.0, -49.0, -42.0, -32.0, -18.0, -5.0, 6.0, 7.0, 3.0, -4.0, -13.0, -31.0, -51.0, -51.0, -50.0, -39.0, -25.0, -10.0, 3.0, 18.0, 38.0, 36.0, 32.0, 26.0, 15.0, 3.0, -6.0, -12.0, -24.0, -41.0, -56.0, -63.0, -66.0, -65.0, -63.0, -62.0, -60.0, -52.0, -42.0, -34.0, -29.0, -28.0, -26.0, -29.0, -37.0, -44.0, -52.0, -62.0, -60.0, -58.0, -56.0, -59.0, -61.0, -60.0, -57.0, -58.0, -62.0, -65.0, -60.0, -52.0, -48.0, -47.0, -43.0, -47.0, -48.0, -49.0, -46.0, -51.0, -60.0, -61.0, -60.0, -59.0, -60.0, -64.0, -69.0, -72.0, -71.0, -71.0, -71.0, -70.0, -68.0, -66.0, -64.0, -65.0, -64.0, -64.0, -65.0, -67.0, -68.0, -71.0, -71.0, -73.0, -75.0, -75.0, -75.0, -75.0, -74.0, -72.0, -71.0, -71.0, -70.0, -71.0, -71.0, -72.0, -76.0, -76.0, -75.0, -75.0, -74.0, -74.0, -74.0, -74.0, -71.0, -69.0, -70.0, -70.0, -69.0, -67.0, -65.0, -66.0, -64.0, -65.0, -71.0, -74.0, -76.0, -82.0, -83.0, -82.0, -79.0, -73.0, -64.0, -62.0, -61.0, -74.0, -86.0, -92.0, -95.0, -79.0, -36.0, 35.0, 87.0, 125.0, 147.0, 151.0, 146.0, 151.0, 150.0, 151.0, 150.0, 150.0, 149.0, -75.0, -80.0, -86.0, -86.0, -80.0, -72.0, -65.0, -64.0, -64.0, -63.0, -64.0, -64.0, -61.0, -61.0, -62.0, -61.0, -59.0, -59.0, -62.0, -64.0, -67.0, -75.0, -78.0, -82.0, -81.0, -73.0, -68.0, -69.0, -70.0, -74.0, -78.0, -83.0, -84.0, -79.0, -75.0, -75.0, -75.0, -75.0, -74.0, -74.0, -75.0, -78.0, -79.0, -75.0, -68.0, -63.0, -62.0, -63.0, -63.0, -57.0, -55.0, -54.0, -54.0, -53.0, -51.0, -49.0, -52.0, -56.0, -59.0, -60.0, -63.0, -59.0, -45.0, -4.0, 38.0, 48.0, 32.0, 22.0, 8.0, -15.0, -46.0, -58.0, -65.0, -65.0, -67.0, -68.0, -66.0, -70.0, -69.0, -69.0, -71.0, -72.0, -73.0, -72.0, -73.0, -73.0, -74.0, -75.0, -76.0, -75.0, -74.0, -74.0, -73.0, -72.0, -73.0, -74.0, -74.0, -75.0, -72.0, -68.0, -64.0, -60.0, -57.0, -52.0, -50.0, -50.0, -50.0, -51.0, -54.0, -53.0, -50.0, -47.0, -46.0, -44.0, -42.0, -42.0, -41.0, -41.0, -41.0, -43.0, -43.0, -44.0, -45.0, -45.0, -46.0, -46.0, -48.0, -48.0, -47.0, -46.0, -43.0, -40.0, -39.0, -37.0, -35.0, -33.0, -32.0, -32.0, -33.0, -33.0, -36.0, -39.0, -44.0, -47.0, -49.0, -47.0, -42.0, -25.0, -13.0, -9.0, -6.0, 1.0, 1.0, -9.0, -20.0, -26.0, -31.0, -34.0, -39.0, -40.0, -37.0, -34.0, -29.0, -28.0, -27.0, -28.0, -27.0, -27.0, -29.0, -31.0, -34.0, -34.0, -37.0, -37.0, -34.0, -33.0, -33.0, -28.0, -13.0, -5.0, -3.0, -5.0, -5.0, -5.0, -7.0, -17.0, -26.0, -33.0, -39.0, -39.0, -35.0, -36.0, -42.0, -42.0, -38.0, -32.0, -31.0, -34.0, -37.0, -36.0, -38.0, -43.0, -43.0, -42.0, -40.0, -41.0, -38.0, -32.0, -21.0, -20.0, -24.0, -23.0, -14.0, -3.0, -5.0, -16.0, -24.0, -26.0, -27.0, -36.0, -44.0, -49.0, -49.0, -45.0, -42.0, -39.0, -36.0, -32.0, -31.0, -32.0, -32.0, -32.0, -29.0, -29.0, -24.0, -18.0, -10.0, -2.0, 3.0, 12.0, 20.0, 30.0, 29.0, 26.0, 24.0, 12.0, -1.0, -6.0, -16.0, -27.0, -26.0, -22.0, -22.0, -24.0, -24.0, -22.0, -21.0, -21.0, -23.0, -23.0, -21.0, -19.0, -21.0, -30.0, -40.0, -43.0, -36.0, -35.0, -41.0, -36.0, -23.0, -18.0, -21.0, -27.0, -30.0, -24.0, -24.0, -32.0, -40.0, -37.0, -33.0, -31.0, -31.0, -34.0, -37.0, -40.0, -40.0, -41.0, -42.0, -42.0, -39.0, -35.0, -36.0, -39.0, -41.0, -36.0, -36.0, -36.0, -36.0, -35.0, -35.0, -32.0, -30.0, -32.0, -36.0, -38.0, -39.0, -44.0, -44.0, -45.0, -44.0, -41.0, -36.0, -33.0, -36.0, -38.0, -37.0, -36.0, -35.0, -40.0, -45.0, -46.0, -47.0, -49.0, -51.0, -53.0, -55.0, -56.0, -59.0, -54.0, -47.0, -39.0, -30.0, -15.0, -1.0, 9.0, 11.0, 7.0, 1.0, -8.0, -26.0, -47.0, -50.0, -49.0, -39.0, -24.0, -11.0, 2.0, 16.0, 31.0, 31.0, 29.0, 25.0, 16.0, 5.0, -2.0, -10.0, -16.0, -31.0, -48.0, -61.0, -66.0, -65.0, -66.0, -61.0, -53.0, -43.0, -31.0, -21.0, -16.0, -14.0, -13.0, -18.0, -27.0, -35.0, -45.0, -57.0, -63.0, -60.0, -56.0, -57.0, -59.0, -58.0, -56.0, -58.0, -61.0, -61.0, -55.0, -46.0, -39.0, -40.0, -41.0, -43.0, -44.0, -46.0, -45.0, -51.0, -60.0, -58.0, -56.0, -55.0, -56.0, -60.0, -65.0, -67.0, -69.0, -68.0, -69.0, -68.0, -66.0, -64.0, -62.0, -62.0, -62.0, -62.0, -63.0, -65.0, -67.0, -70.0, -71.0, -73.0, -74.0, -75.0, -75.0, -74.0, -74.0, -72.0, -71.0, -71.0, -70.0, -71.0, -71.0, -72.0, -75.0, -74.0, -74.0, -74.0, -73.0, -73.0, -73.0, -73.0, -71.0, -69.0, -69.0, -70.0, -69.0, -67.0, -66.0, -71.0, -71.0, -70.0, -72.0, -75.0, -75.0, -72.0, -74.0, -75.0, -77.0, -75.0, -71.0, -66.0, -66.0, -76.0, -88.0, -92.0, -96.0, -82.0, -38.0, 32.0, 84.0, 124.0, 147.0, 151.0, 146.0, 150.0, 150.0, 151.0, 151.0, 150.0, 149.0, -75.0, -81.0, -86.0, -87.0, -80.0, -72.0, -65.0, -62.0, -64.0, -62.0, -63.0, -63.0, -60.0, -60.0, -61.0, -60.0, -58.0, -59.0, -61.0, -62.0, -65.0, -74.0, -77.0, -80.0, -79.0, -70.0, -63.0, -64.0, -62.0, -61.0, -66.0, -76.0, -83.0, -80.0, -75.0, -80.0, -80.0, -81.0, -82.0, -82.0, -84.0, -86.0, -85.0, -80.0, -72.0, -67.0, -64.0, -65.0, -65.0, -60.0, -58.0, -56.0, -56.0, -56.0, -53.0, -52.0, -53.0, -56.0, -58.0, -59.0, -61.0, -58.0, -43.0, -1.0};
    const float32_t arrayB[1024] = {-0.03229166567325592, -0.02421874925494194, 0.03229166567325592, 0.02421874925494194, -0.015625, -0.02421874925494194, 0.04895833507180214, 0.02421874925494194, 0.0010416667209938169, -0.02421874925494194, 0.06562499701976776, 0.02421874925494194, 0.01770833320915699, -0.02421874925494194, 0.08229167014360428, 0.02421874925494194, -0.03229166567325592, -0.01171875, 0.03229166567325592, 0.03671874850988388, -0.015625, -0.01171875, 0.04895833507180214, 0.03671874850988388, 0.0010416667209938169, -0.01171875, 0.06562499701976776, 0.03671874850988388, 0.01770833320915699, -0.01171875, 0.08229167014360428, 0.03671874850988388, -0.03229166567325592, 0.0007812500116415322, 0.03229166567325592, 0.04921875149011612, -0.015625, 0.0007812500116415322, 0.04895833507180214, 0.04921875149011612, 0.0010416667209938169, 0.0007812500116415322, 0.06562499701976776, 0.04921875149011612, 0.01770833320915699, 0.0007812500116415322, 0.08229167014360428, 0.04921875149011612, -0.03229166567325592, 0.01328125037252903, 0.03229166567325592, 0.06171875074505806, -0.015625, 0.01328125037252903, 0.04895833507180214, 0.06171875074505806, 0.0010416667209938169, 0.01328125037252903, 0.06562499701976776, 0.06171875074505806, 0.01770833320915699, 0.01328125037252903, 0.08229167014360428, 0.06171875074505806, -0.06562499701976776, -0.04921875149011612, 0.06562499701976776, 0.04921875149011612, -0.03229166567325592, -0.04921875149011612, 0.0989583358168602, 0.04921875149011612, -0.06562499701976776, -0.02421874925494194, 0.06562499701976776, 0.07421875, -0.03229166567325592, -0.02421874925494194, 0.0989583358168602, 0.07421875, -0.0989583358168602, -0.07421875, 0.16562500596046448, 0.12421874701976776, 0.03437500074505806, -0.02421874925494194, 0.0989583358168602, 0.02421874925494194, 0.05104166641831398, -0.02421874925494194, 0.11562500149011612, 0.02421874925494194, 0.0677083358168602, -0.02421874925494194, 0.13229165971279144, 0.02421874925494194, 0.08437500149011612, -0.02421874925494194, 0.14895834028720856, 0.02421874925494194, 0.03437500074505806, -0.01171875, 0.0989583358168602, 0.03671874850988388, 0.05104166641831398, -0.01171875, 0.11562500149011612, 0.03671874850988388, 0.0677083358168602, -0.01171875, 0.13229165971279144, 0.03671874850988388, 0.08437500149011612, -0.01171875, 0.14895834028720856, 0.03671874850988388, 0.03437500074505806, 0.0007812500116415322, 0.0989583358168602, 0.04921875149011612, 0.05104166641831398, 0.0007812500116415322, 0.11562500149011612, 0.04921875149011612, 0.0677083358168602, 0.0007812500116415322, 0.13229165971279144, 0.04921875149011612, 0.08437500149011612, 0.0007812500116415322, 0.14895834028720856, 0.04921875149011612, 0.03437500074505806, 0.01328125037252903, 0.0989583358168602, 0.06171875074505806, 0.05104166641831398, 0.01328125037252903, 0.11562500149011612, 0.06171875074505806, 0.0677083358168602, 0.01328125037252903, 0.13229165971279144, 0.06171875074505806, 0.08437500149011612, 0.01328125037252903, 0.14895834028720856, 0.06171875074505806, 0.0010416667209938169, -0.04921875149011612, 0.13229165971279144, 0.04921875149011612, 0.03437500074505806, -0.04921875149011612, 0.16562500596046448, 0.04921875149011612, 0.0010416667209938169, -0.02421874925494194, 0.13229165971279144, 0.07421875, 0.03437500074505806, -0.02421874925494194, 0.16562500596046448, 0.07421875, -0.03229166567325592, -0.07421875, 0.23229166865348816, 0.12421874701976776, 0.10104166716337204, -0.02421874925494194, 0.16562500596046448, 0.02421874925494194, 0.11770833283662796, -0.02421874925494194, 0.1822916716337204, 0.02421874925494194, 0.13437500596046448, -0.02421874925494194, 0.19895833730697632, 0.02421874925494194, 0.1510416716337204, -0.02421874925494194, 0.21562500298023224, 0.02421874925494194, 0.10104166716337204, -0.01171875, 0.16562500596046448, 0.03671874850988388, 0.11770833283662796, -0.01171875, 0.1822916716337204, 0.03671874850988388, 0.13437500596046448, -0.01171875, 0.19895833730697632, 0.03671874850988388, 0.1510416716337204, -0.01171875, 0.21562500298023224, 0.03671874850988388, 0.10104166716337204, 0.0007812500116415322, 0.16562500596046448, 0.04921875149011612, 0.11770833283662796, 0.0007812500116415322, 0.1822916716337204, 0.04921875149011612, 0.13437500596046448, 0.0007812500116415322, 0.19895833730697632, 0.04921875149011612, 0.1510416716337204, 0.0007812500116415322, 0.21562500298023224, 0.04921875149011612, 0.10104166716337204, 0.01328125037252903, 0.16562500596046448, 0.06171875074505806, 0.11770833283662796, 0.01328125037252903, 0.1822916716337204, 0.06171875074505806, 0.13437500596046448, 0.01328125037252903, 0.19895833730697632, 0.06171875074505806, 0.1510416716337204, 0.01328125037252903, 0.21562500298023224, 0.06171875074505806, 0.0677083358168602, -0.04921875149011612, 0.19895833730697632, 0.04921875149011612, 0.10104166716337204, -0.04921875149011612, 0.23229166865348816, 0.04921875149011612, 0.0677083358168602, -0.02421874925494194, 0.19895833730697632, 0.07421875, 0.10104166716337204, -0.02421874925494194, 0.23229166865348816, 0.07421875, 0.03437500074505806, -0.07421875, 0.29895833134651184, 0.12421874701976776, 0.16770833730697632, -0.02421874925494194, 0.23229166865348816, 0.02421874925494194, 0.18437500298023224, -0.02421874925494194, 0.24895833432674408, 0.02421874925494194, 0.20104166865348816, -0.02421874925494194, 0.265625, 0.02421874925494194, 0.21770833432674408, -0.02421874925494194, 0.2822916805744171, 0.02421874925494194, 0.16770833730697632, -0.01171875, 0.23229166865348816, 0.03671874850988388, 0.18437500298023224, -0.01171875, 0.24895833432674408, 0.03671874850988388, 0.20104166865348816, -0.01171875, 0.265625, 0.03671874850988388, 0.21770833432674408, -0.01171875, 0.2822916805744171, 0.03671874850988388, 0.16770833730697632, 0.0007812500116415322, 0.23229166865348816, 0.04921875149011612, 0.18437500298023224, 0.0007812500116415322, 0.24895833432674408, 0.04921875149011612, 0.20104166865348816, 0.0007812500116415322, 0.265625, 0.04921875149011612, 0.21770833432674408, 0.0007812500116415322, 0.2822916805744171, 0.04921875149011612, 0.16770833730697632, 0.01328125037252903, 0.23229166865348816, 0.06171875074505806, 0.18437500298023224, 0.01328125037252903, 0.24895833432674408, 0.06171875074505806, 0.20104166865348816, 0.01328125037252903, 0.265625, 0.06171875074505806, 0.21770833432674408, 0.01328125037252903, 0.2822916805744171, 0.06171875074505806, 0.13437500596046448, -0.04921875149011612, 0.265625, 0.04921875149011612, 0.16770833730697632, -0.04921875149011612, 0.29895833134651184, 0.04921875149011612, 0.13437500596046448, -0.02421874925494194, 0.265625, 0.07421875, 0.16770833730697632, -0.02421874925494194, 0.29895833134651184, 0.07421875, 0.10104166716337204, -0.07421875, 0.3656249940395355, 0.12421874701976776, 0.234375, -0.02421874925494194, 0.29895833134651184, 0.02421874925494194, 0.2510416805744171, -0.02421874925494194, 0.31562501192092896, 0.02421874925494194, 0.26770833134651184, -0.02421874925494194, 0.3322916626930237, 0.02421874925494194, 0.28437501192092896, -0.02421874925494194, 0.3489583432674408, 0.02421874925494194, 0.234375, -0.01171875, 0.29895833134651184, 0.03671874850988388, 0.2510416805744171, -0.01171875, 0.31562501192092896, 0.03671874850988388, 0.26770833134651184, -0.01171875, 0.3322916626930237, 0.03671874850988388, 0.28437501192092896, -0.01171875, 0.3489583432674408, 0.03671874850988388, 0.234375, 0.0007812500116415322, 0.29895833134651184, 0.04921875149011612, 0.2510416805744171, 0.0007812500116415322, 0.31562501192092896, 0.04921875149011612, 0.26770833134651184, 0.0007812500116415322, 0.3322916626930237, 0.04921875149011612, 0.28437501192092896, 0.0007812500116415322, 0.3489583432674408, 0.04921875149011612, 0.234375, 0.01328125037252903, 0.29895833134651184, 0.06171875074505806, 0.2510416805744171, 0.01328125037252903, 0.31562501192092896, 0.06171875074505806, 0.26770833134651184, 0.01328125037252903, 0.3322916626930237, 0.06171875074505806, 0.28437501192092896, 0.01328125037252903, 0.3489583432674408, 0.06171875074505806, 0.20104166865348816, -0.04921875149011612, 0.3322916626930237, 0.04921875149011612, 0.234375, -0.04921875149011612, 0.3656249940395355, 0.04921875149011612, 0.20104166865348816, -0.02421874925494194, 0.3322916626930237, 0.07421875, 0.234375, -0.02421874925494194, 0.3656249940395355, 0.07421875, 0.16770833730697632, -0.07421875, 0.4322916567325592, 0.12421874701976776, 0.3010416626930237, -0.02421874925494194, 0.3656249940395355, 0.02421874925494194, 0.3177083432674408, -0.02421874925494194, 0.38229167461395264, 0.02421874925494194, 0.3343749940395355, -0.02421874925494194, 0.39895832538604736, 0.02421874925494194, 0.35104167461395264, -0.02421874925494194, 0.4156250059604645, 0.02421874925494194, 0.3010416626930237, -0.01171875, 0.3656249940395355, 0.03671874850988388, 0.3177083432674408, -0.01171875, 0.38229167461395264, 0.03671874850988388, 0.3343749940395355, -0.01171875, 0.39895832538604736, 0.03671874850988388, 0.35104167461395264, -0.01171875, 0.4156250059604645, 0.03671874850988388, 0.3010416626930237, 0.0007812500116415322, 0.3656249940395355, 0.04921875149011612, 0.3177083432674408, 0.0007812500116415322, 0.38229167461395264, 0.04921875149011612, 0.3343749940395355, 0.0007812500116415322, 0.39895832538604736, 0.04921875149011612, 0.35104167461395264, 0.0007812500116415322, 0.4156250059604645, 0.04921875149011612, 0.3010416626930237, 0.01328125037252903, 0.3656249940395355, 0.06171875074505806, 0.3177083432674408, 0.01328125037252903, 0.38229167461395264, 0.06171875074505806, 0.3343749940395355, 0.01328125037252903, 0.39895832538604736, 0.06171875074505806, 0.35104167461395264, 0.01328125037252903, 0.4156250059604645, 0.06171875074505806, 0.26770833134651184, -0.04921875149011612, 0.39895832538604736, 0.04921875149011612, 0.3010416626930237, -0.04921875149011612, 0.4322916567325592, 0.04921875149011612, 0.26770833134651184, -0.02421874925494194, 0.39895832538604736, 0.07421875, 0.3010416626930237, -0.02421874925494194, 0.4322916567325592, 0.07421875, 0.234375, -0.07421875, 0.4989583194255829, 0.12421874701976776, 0.36770832538604736, -0.02421874925494194, 0.4322916567325592, 0.02421874925494194, 0.3843750059604645, -0.02421874925494194, 0.4489583373069763, 0.02421874925494194, 0.4010416567325592, -0.02421874925494194, 0.46562498807907104, 0.02421874925494194, 0.4177083373069763, -0.02421874925494194, 0.48229166865348816, 0.02421874925494194, 0.36770832538604736, -0.01171875, 0.4322916567325592, 0.03671874850988388, 0.3843750059604645, -0.01171875, 0.4489583373069763, 0.03671874850988388, 0.4010416567325592, -0.01171875, 0.46562498807907104, 0.03671874850988388, 0.4177083373069763, -0.01171875, 0.48229166865348816, 0.03671874850988388, 0.36770832538604736, 0.0007812500116415322, 0.4322916567325592, 0.04921875149011612, 0.3843750059604645, 0.0007812500116415322, 0.4489583373069763, 0.04921875149011612, 0.4010416567325592, 0.0007812500116415322, 0.46562498807907104, 0.04921875149011612, 0.4177083373069763, 0.0007812500116415322, 0.48229166865348816, 0.04921875149011612, 0.36770832538604736, 0.01328125037252903, 0.4322916567325592, 0.06171875074505806, 0.3843750059604645, 0.01328125037252903, 0.4489583373069763, 0.06171875074505806, 0.4010416567325592, 0.01328125037252903, 0.46562498807907104, 0.06171875074505806, 0.4177083373069763, 0.01328125037252903, 0.48229166865348816, 0.06171875074505806, 0.3343749940395355, -0.04921875149011612, 0.46562498807907104, 0.04921875149011612, 0.36770832538604736, -0.04921875149011612, 0.4989583194255829, 0.04921875149011612, 0.3343749940395355, -0.02421874925494194, 0.46562498807907104, 0.07421875, 0.36770832538604736, -0.02421874925494194, 0.4989583194255829, 0.07421875, 0.3010416626930237, -0.07421875, 0.565625011920929, 0.12421874701976776, 0.43437498807907104, -0.02421874925494194, 0.4989583194255829, 0.02421874925494194, 0.45104166865348816, -0.02421874925494194, 0.515625, 0.02421874925494194, 0.4677083194255829, -0.02421874925494194, 0.5322916507720947, 0.02421874925494194, 0.484375, -0.02421874925494194, 0.5489583611488342, 0.02421874925494194, 0.43437498807907104, -0.01171875, 0.4989583194255829, 0.03671874850988388, 0.45104166865348816, -0.01171875, 0.515625, 0.03671874850988388, 0.4677083194255829, -0.01171875, 0.5322916507720947, 0.03671874850988388, 0.484375, -0.01171875, 0.5489583611488342, 0.03671874850988388, 0.43437498807907104, 0.0007812500116415322, 0.4989583194255829, 0.04921875149011612, 0.45104166865348816, 0.0007812500116415322, 0.515625, 0.04921875149011612, 0.4677083194255829, 0.0007812500116415322, 0.5322916507720947, 0.04921875149011612, 0.484375, 0.0007812500116415322, 0.5489583611488342, 0.04921875149011612, 0.43437498807907104, 0.01328125037252903, 0.4989583194255829, 0.06171875074505806, 0.45104166865348816, 0.01328125037252903, 0.515625, 0.06171875074505806, 0.4677083194255829, 0.01328125037252903, 0.5322916507720947, 0.06171875074505806, 0.484375, 0.01328125037252903, 0.5489583611488342, 0.06171875074505806, 0.4010416567325592, -0.04921875149011612, 0.5322916507720947, 0.04921875149011612, 0.43437498807907104, -0.04921875149011612, 0.565625011920929, 0.04921875149011612, 0.4010416567325592, -0.02421874925494194, 0.5322916507720947, 0.07421875, 0.43437498807907104, -0.02421874925494194, 0.565625011920929, 0.07421875, 0.36770832538604736, -0.07421875, 0.6322916746139526, 0.12421874701976776, 0.5010416507720947, -0.02421874925494194, 0.565625011920929, 0.02421874925494194, 0.5177083611488342, -0.02421874925494194, 0.5822916626930237, 0.02421874925494194, 0.534375011920929, -0.02421874925494194, 0.5989583134651184, 0.02421874925494194, 0.5510416626930237, -0.02421874925494194, 0.6156250238418579, 0.02421874925494194, 0.5010416507720947, -0.01171875, 0.565625011920929, 0.03671874850988388, 0.5177083611488342, -0.01171875, 0.5822916626930237, 0.03671874850988388, 0.534375011920929, -0.01171875, 0.5989583134651184, 0.03671874850988388, 0.5510416626930237, -0.01171875, 0.6156250238418579, 0.03671874850988388, 0.5010416507720947, 0.0007812500116415322, 0.565625011920929, 0.04921875149011612, 0.5177083611488342, 0.0007812500116415322, 0.5822916626930237, 0.04921875149011612, 0.534375011920929, 0.0007812500116415322, 0.5989583134651184, 0.04921875149011612, 0.5510416626930237, 0.0007812500116415322, 0.6156250238418579, 0.04921875149011612, 0.5010416507720947, 0.01328125037252903, 0.565625011920929, 0.06171875074505806, 0.5177083611488342, 0.01328125037252903, 0.5822916626930237, 0.06171875074505806, 0.534375011920929, 0.01328125037252903, 0.5989583134651184, 0.06171875074505806, 0.5510416626930237, 0.01328125037252903, 0.6156250238418579, 0.06171875074505806, 0.4677083194255829, -0.04921875149011612, 0.5989583134651184, 0.04921875149011612, 0.5010416507720947, -0.04921875149011612, 0.6322916746139526, 0.04921875149011612, 0.4677083194255829, -0.02421874925494194, 0.5989583134651184, 0.07421875, 0.5010416507720947, -0.02421874925494194, 0.6322916746139526, 0.07421875, 0.43437498807907104, -0.07421875, 0.6989583373069763, 0.12421874701976776, 0.5677083134651184, -0.02421874925494194, 0.6322916746139526, 0.02421874925494194, 0.5843750238418579, -0.02421874925494194, 0.6489583253860474, 0.02421874925494194, 0.6010416746139526, -0.02421874925494194, 0.6656249761581421, 0.02421874925494194, 0.6177083253860474, -0.02421874925494194, 0.6822916865348816, 0.02421874925494194, 0.5677083134651184, -0.01171875, 0.6322916746139526, 0.03671874850988388, 0.5843750238418579, -0.01171875, 0.6489583253860474, 0.03671874850988388, 0.6010416746139526, -0.01171875, 0.6656249761581421, 0.03671874850988388, 0.6177083253860474, -0.01171875, 0.6822916865348816, 0.03671874850988388, 0.5677083134651184, 0.0007812500116415322, 0.6322916746139526, 0.04921875149011612, 0.5843750238418579, 0.0007812500116415322, 0.6489583253860474, 0.04921875149011612, 0.6010416746139526, 0.0007812500116415322, 0.6656249761581421, 0.04921875149011612, 0.6177083253860474, 0.0007812500116415322, 0.6822916865348816, 0.04921875149011612, 0.5677083134651184, 0.01328125037252903, 0.6322916746139526, 0.06171875074505806, 0.5843750238418579, 0.01328125037252903, 0.6489583253860474, 0.06171875074505806, 0.6010416746139526, 0.01328125037252903, 0.6656249761581421, 0.06171875074505806, 0.6177083253860474, 0.01328125037252903, 0.6822916865348816, 0.06171875074505806, 0.534375011920929, -0.04921875149011612, 0.6656249761581421, 0.04921875149011612, 0.5677083134651184, -0.04921875149011612, 0.6989583373069763, 0.04921875149011612, 0.534375011920929, -0.02421874925494194, 0.6656249761581421, 0.07421875, 0.5677083134651184, -0.02421874925494194, 0.6989583373069763, 0.07421875, 0.5010416507720947, -0.07421875, 0.765625, 0.12421874701976776, 0.6343749761581421, -0.02421874925494194, 0.6989583373069763, 0.02421874925494194, 0.6510416865348816, -0.02421874925494194, 0.715624988079071, 0.02421874925494194, 0.6677083373069763, -0.02421874925494194, 0.7322916388511658, 0.02421874925494194, 0.684374988079071, -0.02421874925494194, 0.7489583492279053, 0.02421874925494194, 0.6343749761581421, -0.01171875, 0.6989583373069763, 0.03671874850988388, 0.6510416865348816, -0.01171875, 0.715624988079071, 0.03671874850988388, 0.6677083373069763, -0.01171875, 0.7322916388511658, 0.03671874850988388, 0.684374988079071, -0.01171875, 0.7489583492279053, 0.03671874850988388, 0.6343749761581421, 0.0007812500116415322, 0.6989583373069763, 0.04921875149011612, 0.6510416865348816, 0.0007812500116415322, 0.715624988079071, 0.04921875149011612, 0.6677083373069763, 0.0007812500116415322, 0.7322916388511658, 0.04921875149011612, 0.684374988079071, 0.0007812500116415322, 0.7489583492279053, 0.04921875149011612, 0.6343749761581421, 0.01328125037252903, 0.6989583373069763, 0.06171875074505806, 0.6510416865348816, 0.01328125037252903, 0.715624988079071, 0.06171875074505806, 0.6677083373069763, 0.01328125037252903, 0.7322916388511658, 0.06171875074505806, 0.684374988079071, 0.01328125037252903, 0.7489583492279053, 0.06171875074505806, 0.6010416746139526, -0.04921875149011612, 0.7322916388511658, 0.04921875149011612, 0.6343749761581421, -0.04921875149011612, 0.765625, 0.04921875149011612, 0.6010416746139526, -0.02421874925494194, 0.7322916388511658, 0.07421875, 0.6343749761581421, -0.02421874925494194, 0.765625, 0.07421875, 0.5677083134651184, -0.07421875, 0.8322916626930237, 0.12421874701976776, 0.7010416388511658, -0.02421874925494194, 0.765625, 0.02421874925494194, 0.7177083492279053, -0.02421874925494194, 0.7822916507720947, 0.02421874925494194, 0.734375, -0.02421874925494194, 0.7989583611488342, 0.02421874925494194, 0.7510416507720947, -0.02421874925494194, 0.815625011920929, 0.02421874925494194, 0.7010416388511658, -0.01171875, 0.765625, 0.03671874850988388, 0.7177083492279053, -0.01171875, 0.7822916507720947, 0.03671874850988388, 0.734375, -0.01171875, 0.7989583611488342, 0.03671874850988388, 0.7510416507720947, -0.01171875, 0.815625011920929, 0.03671874850988388, 0.7010416388511658, 0.0007812500116415322, 0.765625, 0.04921875149011612, 0.7177083492279053, 0.0007812500116415322, 0.7822916507720947, 0.04921875149011612, 0.734375, 0.0007812500116415322, 0.7989583611488342, 0.04921875149011612, 0.7510416507720947, 0.0007812500116415322, 0.815625011920929, 0.04921875149011612, 0.7010416388511658, 0.01328125037252903, 0.765625, 0.06171875074505806, 0.7177083492279053, 0.01328125037252903, 0.7822916507720947, 0.06171875074505806, 0.734375, 0.01328125037252903, 0.7989583611488342, 0.06171875074505806, 0.7510416507720947, 0.01328125037252903, 0.815625011920929, 0.06171875074505806, 0.6677083373069763, -0.04921875149011612, 0.7989583611488342, 0.04921875149011612, 0.7010416388511658, -0.04921875149011612, 0.8322916626930237, 0.04921875149011612, 0.6677083373069763, -0.02421874925494194, 0.7989583611488342, 0.07421875, 0.7010416388511658, -0.02421874925494194, 0.8322916626930237, 0.07421875, 0.6343749761581421, -0.07421875, 0.8989583253860474, 0.12421874701976776, 0.7677083611488342, -0.02421874925494194, 0.8322916626930237, 0.02421874925494194, 0.784375011920929, -0.02421874925494194, 0.8489583134651184, 0.02421874925494194, 0.8010416626930237, -0.02421874925494194, 0.8656250238418579, 0.02421874925494194, 0.8177083134651184, -0.02421874925494194, 0.8822916746139526, 0.02421874925494194};

    float32_t result = 0.0;
    clock_t start = clock();
    for(int i=0; i<1024; i++){
        vector_dot_c(arrayA, arrayB, &result, 1024);
    }
    clock_t end = clock();
    printf("c spend time :%ld\n", end-start);

    float32_t result1 = 0.0;
    start = clock();
    for(int i=0; i<1024; i++){
        vector_dot_intrinsics(arrayA, arrayB, &result1, 1024);
    }
    end = clock();
    printf("intrinsics spend time :%ld\n", end-start);

    float32_t result2 = 0.0;
    start = clock();
    float32_t assembly_result[5] = {0.0};
    for(int i=0; i<1024; i++){
        vector_dot_assembly(arrayA, arrayB, assembly_result, 1024);
        result2 = assembly_result[0] + assembly_result[1] + assembly_result[2] + assembly_result[3];
    }
    end = clock();
    printf("assembly spend time :%ld\n\n", end-start);

    printf("intrinsics result compare with c result diff:%f\n", abs(result-result1));
    printf("assembly result compare with c result diff:%f\n", abs(result-result2));

    return 0;

}